package com.paper.tiger.easy.rpc.s.client.common;

import com.paper.tiger.easy.rpc.annotation.AsyncCall;

/**
 * [简要描述]: 调用时的客户端与服务端请求封装
 * [详细描述]:
 *
 * @author ZouHaiBo
 * @version 1.0, 2021/6/17 19:30
 * @since JDK 1.8
 */
public class Dove
{
    //1. 服务端客户端心跳维持
    //2. 客户端调用服务端服务
    //3. 服务端响应客户端调用结果

    /**
     * {@link LetterType}
     */
    private Integer letterType;

    /**
     * 调用id
     */
    private String doveId;

    /**
     * 调用参数
     */
    private Letter letter;

    /**
     * 返回结果
     */
    private Object result;
    /**
     * 是否返回数据 返回值是否为void
     */
    private Boolean returnNull;
    /**
     * 默认调用正确
     */
    private Boolean exceptionFlag = false;
    /**
     * 调用服务发生的异常信息
     */
    private Throwable e;
    /**
     * 是否同步，默认为同步调用
     */
    private Boolean sync  = true;
    /**
     * 异步调用实现类
     */
    private Class<? extends AsyncCall> asyncClass;


    private String ip;

    private Integer port;

    private String serviceName;

    public String getServiceName()
    {
        return serviceName;
    }

    public void setServiceName(String serviceName)
    {
        this.serviceName = serviceName == null ? null : "".equals(serviceName.trim()) ? null : serviceName.trim();
    }

    public String getIp()
    {
        return ip;
    }

    public void setIp(String ip)
    {
        this.ip = ip == null ? null : "".equals(ip.trim()) ? null : ip.trim();
    }

    public Integer getPort()
    {
        return port;
    }

    public void setPort(Integer port)
    {
        this.port = port;
    }

    public Class<? extends AsyncCall> getAsyncClass()
    {
        return asyncClass;
    }

    public void setAsyncClass(Class<? extends AsyncCall> asyncClass)
    {
        this.asyncClass = asyncClass;
    }

    public Boolean getSync()
    {
        return sync;
    }

    public void setSync(Boolean sync)
    {
        this.sync = sync;
    }

    public Boolean getReturnNull()
    {
        return returnNull;
    }

    public void setReturnNull(Boolean returnNull)
    {
        this.returnNull = returnNull;
    }

    public Boolean getExceptionFlag()
    {
        return exceptionFlag;
    }

    public void setExceptionFlag(Boolean exceptionFlag)
    {
        this.exceptionFlag = exceptionFlag;
    }

    public Throwable getE()
    {
        return e;
    }

    public void setE(Throwable e)
    {
        this.e = e;
    }

    public String getDoveId()
    {
        return doveId;
    }

    public void setDoveId(String doveId)
    {
        this.doveId = doveId == null ? null : "".equals(doveId.trim()) ? null : doveId.trim();
    }

    public Integer getLetterType()
    {
        return letterType;
    }

    public void setLetterType(Integer letterType)
    {
        this.letterType = letterType;
    }

    public Letter getLetter()
    {
        return letter;
    }

    public void setLetter(Letter letter)
    {
        this.letter = letter;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }
}
